// @charset "utf-8";

define(function(require, exports, module) {

	var userPath = null,
		cachePath = null,
		fis = null,
		fos = null;
	try {
		userPath = external.getUserPath();
		cachePath = userPath + 'ths_exammarket\\';
		fis = external.createObject('FileInputStream');
		fos = external.createObject('FileOutputStream');
	} catch (exp) {}
	var clientStorage = {
		getFileContent: function(file) {
			if (null === fis) {
				return false;
			}
			var str = false;
			if (fis.open(cachePath + file)) {
				try {
					// str = fis.readDes();
					str = fis.read();
				} catch (exp) {}
				fis.close();
			}
			if (false === str || str == '') {
				return false;
			}
			return eval('(' + str + ')');
		},
		writeFileContent: function(file, jsonstr) {
			var str = '';
			if (null === fos) {
				return false;
			}
			if (fos.open(cachePath + file)) {
				try {
					// str = fos.writeDes(jsonstr);
					str = fos.write(jsonstr);
				} catch (exp) {}
				fos.close();
			}
		}
	};

	module.exports = clientStorage;
});